﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

using MvcContrib.FluentHtml;

using Revis.VClinicNet.App.Internal.Dto;
using Revis.VClinicNet.Core.Domain.Credentials;
using Revis.VClinicNet.Util.Translation;

namespace Revis.VClinicNet.UI.Internal.Mvc.Models.Forms
{
    public class WorkerUserCreateForm : ModelViewPage<WorkerUserCreateDto>
    {
        public IEnumerable<SelectListItem> Roles()
        {           
            List<SelectListItem> items = new List<SelectListItem>();
            foreach (WorkerUserRole role in Enum.GetValues(typeof(WorkerUserRole))) {
                items.Add(new SelectListItem() {
                    Text = role.ToPLString(),
                    Value = ((int)role).ToString()
                });
            }
            string selected = Model != null ? ((int)Model.Role).ToString() : ((int)WorkerUserRole.Doctor).ToString();
            items.Find(i => i.Value == selected).Selected = true;
            return items;
        }
    }
}